﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace model
{
    public class MemberContext : DbContext
    {
        public DbSet<model.Member> Members { get; set; }
        public DbSet<model.Boat> Boats { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Boat>().HasRequired<Member>(s => s.Member)
            .WithMany(s => s.BoatsList).HasForeignKey(s => s.memberId);

            base.OnModelCreating(modelBuilder);
        }

    }
}
